﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.ServiceModel;
using WcfServiceLibrary1;
using ArekChatClient.ServiceReference1;

namespace Kliens
{
    public partial class Form_Msg : Form
    {
        public Form_Msg()
        {
            InitializeComponent();
            WcfServiceLibrary1.IService1 vService;
            NetTcpBinding b = new NetTcpBinding();
            b.Security.Mode = SecurityMode.Message;
            b.Security.Message.ClientCredentialType = MessageCredentialType.Windows;

            EndpointAddress vEndPoint = new EndpointAddress("net.tcp://193.225.227.148/myservice");
            ChannelFactory<WcfServiceLibrary1.IService1> cf = new ChannelFactory<WcfServiceLibrary1.IService1>(b, vEndPoint);

            vService = cf.CreateChannel();
            try
            {
                MessageBox.Show("Eredmény a Systemtől : " + vService.SayHello());
            }

            catch (Exception ex)
            {
                MessageBox.Show("Hiba a kapcsolat létrehozásakor" + vEndPoint.Uri.ToString());
            }

        }

        private void button_send_Click(object sender, EventArgs e)
        {
            ArekChatClient.ServiceReference1.Service1Client cl = new Service1Client();
            richTextBox_wall.Text += cl.Repeater("Ádám", textBox_msg.Text) + '\n';
            
        }
    }
}
